Skip to content

http-client: support CIDR in no_proxy - #2495

Open
silverwind wants to merge 3 commits into
actions:mainfrom
silverwind:no-proxy-cidr
Open

silverwind wants to merge 3 commits into
actions:mainfrom
silverwind:no-proxy-cidr

Conversation

@silverwind

@silverwind silverwind commented Sep 15, 2026 •

Copy link
Copy Markdown

Support CIDR syntax in the no_proxy parsing of http-client.

The best "spec" on this topic is https://about.gitlab.com/blog/we-need-to-talk-no-proxy/ which shows the go and ruby parsers and probably others support CIDR in no_proxy and I have a specific use case where this broke when having 10.0.0.0/8 inside no_proxy.

Created with assistance of Claude Opus 5 and GPT 6 Astra.

Entries like 10.0.0.0/8 were compared as plain strings, so requests to IP
hosts in such ranges went through the proxy even though curl, Go and most
other clients bypass it.

Co-Authored-By: Claude (Opus 5) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 15, 2026 12:15
@silverwind
silverwind requested a review from a team as a code owner September 15, 2026 12:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Reject malformed CIDR entries containing extra path components.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds IPv4 and IPv6 CIDR support to no_proxy handling in the HTTP client.

Changes:

  • Uses Node’s BlockList for CIDR matching.
  • Adds tests for valid and invalid CIDR entries.
File summaries
File Description
packages/http-client/src/proxy.ts Implements CIDR-based proxy bypass matching.
packages/http-client/__tests__/proxy.test.ts Tests IPv4/IPv6 CIDR behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/http-client/src/proxy.ts Outdated
An entry like 10.0.0.0/8/x was matched as 10.0.0.0/8.

Co-Authored-By: Claude (Opus 5) <noreply@anthropic.com>
Comment thread packages/http-client/__tests__/proxy.test.ts Outdated
@silverwind silverwind changed the title http-client: support CIDR ranges in no_proxy http-client: support CIDR in no_proxy Sep 16, 2026
Sirherobrine23 pushed a commit to Sirherobrine23/gitea-runner that referenced this pull request Sep 24, 2026
Make cache requests go through the runner and remove outbound traffic from the cache server. The runner forwards them to `cache.external_server` when one is set, and attaches itself to each job network so jobs can reach it.

Benefits:

1. Jobs need no http proxy rules for the cache server, which `@actions/http-client` mishandles for CIDR ranges in `no_proxy` (actions/toolkit#2495).
2. Only runners reach a shared cache server, which needs no route to Gitea.
3. A runner container sharing the host Docker socket now caches, where jobs previously could not reach it.

Breaks:

1. Jobs that reach `external_server` but not their runner, such as a remote `DOCKER_HOST`. The built-in cache has always needed that reachability, so both modes now agree. Set `cache.host` and `cache.port` to an address those jobs reach.
2. Jobs on `container.network: bridge`, where Docker rejects the alias, so the runner cannot attach and their cache fails as it does today. Leave `container.network` empty, or name a user-defined network.

*Written by Claude.*

---------

Co-authored-by: bircni <bircni@icloud.com>
Reviewed-on: https://gitea.com/gitea/runner/pulls/1229
Reviewed-by: bircni <bircni@icloud.com>
Co-authored-by: silverwind <2021+silverwind@noreply.gitea.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants